#include <iostream>
#include <string>
#include "fast.pb.h"


int main()
{
	std::string people_str;
	// 对年龄姓名进行序列化
	{
		fast::PeopleInfo people;
		people.set_age(10);
		people.set_name("夏泽霖");
		if(!people.SerializeToString(&people_str))
		{
			std::cout << "序列化失败" << std::endl;
		}
		std::cout << "序列化成功，结果：" << people_str << std::endl; 
	}
	// 对年龄姓名进行反序列化
	{
		fast::PeopleInfo people;
		if(!people.ParseFromString(people_str))
		{
			std::cout << "反序列化失败" << std::endl;
		}
		std::cout << "反序列化成功，结果：" << "姓名：" << people.name() << " 年龄：" << people.age() << std::endl; 
	}
	return 0;
}